﻿/************************************************************************
* Copyright (c) 2018 All Rights Reserved.
* 命名空间：JsonDaHelper
* 文件名：Utils
* 创建人：David Rodríguez
* 创建时间：2018/8/24 星期五 15:46:04
* 描述：
*************************************************************************/

using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JsonDaHelper
{
    public class Utils
    {
        public static string ConTest()
        {
            var mySqlCon = new SqlConnection(JsonSHeper.Con);
            var re = "";
            try
            {
                mySqlCon.Open();
                re = "OK";
            }
            catch (Exception e)
            {
                re = "Fuck:" + e.Message;
            }
            finally
            {
                mySqlCon.Close();
            }

            return re;
        }

        public static string ChangeFuck(string u, string n)
        {
            try
            {
                var sql = $"update ticket_buylog set de_id={n} where user_id={u}";
                return JsonSHeper.ExecuteNonQuery(sql).ToString();
            }
            catch (Exception e)
            {
                return $"error:" + e.Message;
            }
        }
    }
}